﻿@model IQueryable<ESN.Models.Exercise>

@{
    ViewBag.Title = "My";
}
<script type="text/javascript">
    $(document).ready(function () {
        $(".deleteEx").live("click", function () {
            var link = $(this);
            var sure = confirm('Are you sure that you want to delete the exercise name "' + link.attr("data-name") + '"? This action cannot be undo!');
            if (sure) {
                $.getJSON("/QuizService.svc/DeleteExercises?id=" + link.attr("data-id"), function (result) {
                    if (result.d.DeleteExercises) {
                        link.parent().parent().remove();
                    }
                });
            }
        });
    });
</script>
<h2>My</h2>
<table>
    <tr>
        <th>@ESN.Languages.LangString.Load("name", "Quiz")</th>
        <th>@ESN.Languages.LangString.Load("at", "Quiz")</th>
        <th>@ESN.Languages.LangString.Load("in", "Quiz")</th>
        <th></th>
    </tr>
@foreach (var e in Model)
{
    <tr>
        <td><a href="/Quiz/TestInfo/@e.ExId">@e.ExName</a></td> 
        <td>@e.ExCreateTime</td>
        <td>@e.Categories.CatName</td>
        <td><a data-id="@e.ExId" data-name="@e.ExName" class="deleteEx">@ESN.Languages.LangString.Load("delete", "Quiz")</a>/<a>@ESN.Languages.LangString.Load("edit", "Quiz")</a></td>
    </tr>
}
</table>
